<!DOCTYPE html>
<html lang="zh-CN">
<%@ page language="java" import="com.siysoft.tc.base.bean.to.User" pageEncoding="UTF-8"%>
<%	
User us = (User)session.getAttribute("user");
if(us==null){
		response.sendRedirect(request.getContextPath()+"/app/login_index.htm");
		return;
}
%>
<head>
<title>首页</title>
<%@include file="/common/head.jsp"%>
</head>
  <body class="index-body">
  <div class="filterBg"></div>
    <div class="header">
    	<%@include file="/common/header.jsp"%>
        
        <div class="head">
        	<div class="container">
            	<div class="logo"><a href="<%=request.getContextPath()%>/app/index.htm"><span class="logoF f35"><span style="color:#19d4b3">TC</span><span style="color:#2d3a4c">LOGO</span></span></a></div>
                <div class="nav">
                	<a href="<%=request.getContextPath()%>/app/index.htm" class="on">Home</a><a href="<%=request.getContextPath()%>/app/personal.htm">Personal</a><a href="<%=request.getContextPath()%>/app/protocol.htm">Protocal</a> 
                </div>
            </div>
        </div>
        
    </div>



<div class="flexslider" id="flexslider">
	<div class="sliderLink">
    	<p class="t">Welcome to TC</p>
        <p class="new"><a href="#">New</a></p>
    </div>

	<ul class="slides">
		<li style="background:url(<%=request.getContextPath()%>/common/images/img1.jpg) center 0 no-repeat;"></li>
		<li style="background:#06090e url(<%=request.getContextPath()%>/common/images/img2.jpg) center 0 no-repeat;"></li>
		<li style="background:url(<%=request.getContextPath()%>/common/images/img1.jpg) center 0 no-repeat;"></li>
		<li style="background:#06090e url(<%=request.getContextPath()%>/common/images/img2.jpg) center 0 no-repeat;"></li>
	</ul>
    <div class="shangla"><span id="shangla"><img src="<%=request.getContextPath()%>/common/images/shangla.png"></span><span style="display:none" id="shangla1"><img src="<%=request.getContextPath()%>/common/images/shangla1.png" ></span></div>   
</div>

<!-- 代码end -->

<div class="searchWrap">
	<div class="container">
    	<div class="row">
        	<div class="col-xs-2 title">
            	<p>Find Your</p>
                <p class="c-text">Course</p>
            </div>
            <div class="col-xs-1">
            	<p class="mt">Lecturer</p>
            </div>
            <div class="col-xs-3">
            	<input type="text" id="lecture">
            </div>
            <div class="col-xs-1">
            	<p class="mt">Course</p>
            </div>
            <div class="col-xs-3">
            	<select id="course">
            	</select>
            </div>
            <div class="col-xs-2">
            	<button id="search_lecture">Search</button>
            </div>
        </div>
    </div>
</div>


<div class="classifyWrap">
	<div class="container" id="select_clauses">
    	<div class="row">
        	<div class="col-xs-2">Department</div>
            <div class="col-xs-10">
            	<a href="#"><input class="department_list" name="" type="checkbox" value="">Physics</a>
            	<a href="#"><input class="department_list" name="" type="checkbox" value="">Math</a>
            </div>
        </div>
        <div class="row">
        	<div class="col-xs-2">Grade</div>
            <div class="col-xs-10">
            	<a href="#"><input class="grade_list" name="" type="checkbox" value="">1</a>
            	<a href="#"><input class="grade_list" name="" type="checkbox" value="">2</a>
            </div>
        </div>
        <div class="row">
	        	<div class="col-xs-2">Goal</div>
	            <div class="col-xs-10">
	            	<a href="#"><input class="goal_list" name="" type="checkbox" value="60">pass</a>
	            	<a href="#"><input class="goal_list" name="" type="checkbox" value="80">more than pass</a>
	            </div>
        </div>
    </div>
</div>

<div class="Bestteacher" id="Bestteacher">

	<div class="h2">Best Teacher For You</div>
	<ul class="slides" id="list_lecture">
	</ul>  
</div>
<div style="min-height:150px;text-align:center;font-size:30px;line-height:150px">广告位</div>
<!-- 代码end -->

<div class="Reservation">
	<div class="h2">Reservation</div>
    <div class="container">
    	   <div class="row" id="reservation">
           </div>
           <div class="more"><a href="javascript:;">More</a></div>
   </div>
</div>    

<div class="footer">
	<div class="copyright">CopyRight©2011-2016 All Rights Reserved 京ICP备14007420号-1    京公网安备11010502026102</div>
</div>

<div class="footer-nav">
        <div class="container">
            <a href="javascript:;" class="friendsBtn">Friends</a><a href="javascript:;" class="f-Classroom">Classroom<c id="classroom_new_remind"></c></a>
        </div>    
</div>

<!--classroom-->
<div class="classroom">
	<ul id="classroom_list">
    
    </ul>
</div>
<!--coursename-->
<div class="coursename">
	<div class="title"><a href="javascript:;" class="glyphicon glyphicon-menu-left jt"></a><c id="classroom_detail_course_name" class="text"></c><span class="head glyphicon glyphicon-user"></span></div>
    <div class="coursename-tab">
    	<ul>
        	<li class="on"><span>Details</span></li>
            <li><span id="classroom_detail_chatting">Chatting</span></li>
            <li><span>Member</span></li>
        </ul>
    </div>
    <div class="coursename-list">
    	<div class="coursename_cont coursename_cont10" style=" display:block">
    	<ul id="detailsUl">
        	<li>Reservation Code: <input type="text" readOnly="true" id="classroom_detail_reservation_number" class="text" value=""></li>
            <li>University: <input type="text" id="classroom_detail_school" class="text" value=""><span class="classroom_detail_edit"><span class="glyphicon glyphicon-edit"></span></span></li>
            <li>Lecturer: <span class="green"><input type="text" id="classroom_detail_lecture" class="text"></span><span class="classroom_detail_edit"><span class="glyphicon glyphicon-edit"></span></span></li>
            <li>Maximum Class Size: <input type="text" id="classroom_detail_max_size" class="text"><span class="classroom_detail_edit"><span class="glyphicon glyphicon-edit"></span></span></li>
            <li>Address: <input type="text" id="classroom_detail_adress" class="text"><span class="classroom_detail_edit"><span class="glyphicon glyphicon-edit"></span></span></li>
            <li>Time: <input type="text" id="classroom_detail_time" class="text" readonly="readonly" onclick="SelectDate(this,'yyyy-MM-dd hh:mm:ss')"><span class="classroom_detail_edit"><span class="glyphicon glyphicon-edit"></span></span></li>
            <li>Period: <input type="text" id="classroom_detail_period" class="text"><span class="classroom_detail_edit"><span class="glyphicon glyphicon-edit"></span></span></li>
            <li>Goal: <input type="text" id="classroom_detail_goal" class="text"><span class="classroom_detail_edit"><span class="glyphicon glyphicon-edit"></span></span></li>
            <li>Hourly Payment: <input type="text" id="classroom_detail_wage" class="text"><span class="classroom_detail_edit"><span class="glyphicon glyphicon-edit"></span></span></li>
            <li>Bonus: <input type="text" id="classroom_detail_bonus" class="text"><span class="classroom_detail_edit"><span class="glyphicon glyphicon-edit"></span></span></li>
            
        </ul>
        <div class="bot"><div class="confirm"><a href="#" id="classroom_detail_confirm">confirm</a></div><span class="classroom_detail_exit" id="classroom_detail_exit_status"><span class="glyphicon glyphicon-log-out"></span></span></div>
        </div>
        <div class="coursename_cont coursename_cont2">
        <ul class="ul2" id="room_chat_list">
        </ul>
        <div class="send"><input type="text" id="room_chat_content"><div class="button" id="room_chat_send">Send</div></div>
        </div>
        
        <!--新增member-->
        <div class="coursename_cont coursename_cont3">
        	<p class="t">Teacher</p>
        	<ul id="classroom_member_teacher">
            </ul>
            <p class="t">Student</p>
        	<ul id="classroom_member_student">
            </ul>
            <div class="classroom-user-search" style="">
		    	<div class="top" id="classroom_user_search_list"></div>
		        <div class="input"><input type="text" class="serachInput" placeholder="inviting your lecturer/ friends here"></div>
		    </div>
		    <div class="classroom-user-btn" id="search-btn"><span class="glyphicon glyphicon-search"></span></div>
        </div>
        
        
    </div>
</div>

<!--classroom drop out-->
<div class="classroom_detail_dropOut">
	<div class="title">Do you really want to drop out?</div>
    <div class="button">
    	<a href="javascript:;" class="yes" id="classroom_detail_drop_out">Yes</a>
        <a href="javascript:;" class="no">No</a>
    </div>
</div>

<!--coursename-->
<div class="member-list">
<div class="title"><a href="javascript:;" class="glyphicon glyphicon-menu-left jt"></a><span class="head glyphicon glyphicon-user"></span></div>
    <ul id="classroom_member_list">
    </ul>
</div>

<%@include file="/common/personal_detail.jsp"%>

<!--friends-->
<div class="friends">
	<ul id="friend_list">
    </ul>
    <div class="friends-search">
    	<div class="top" id="friend_search_list"></div>
        <div class="input"><input type="text" class="serachInput"></div>
    </div>
    <div class="friends-search-btn"><span class="glyphicon glyphicon-search"></span></div>
    
</div>


<div class="chooseClassRoom">
	<a href="javascript:;" class="glyphicon glyphicon-menu-left jt" style=""></a>
    <div class="cont">
    	<div class="t green">Choose a Classroom</div>
        <div class="j">▼</div>
        <ul id="friend_choose_classroom">
        	<li><span class="glyphicon glyphicon-user"></span><span class="glyphicon glyphicon-user"></span><a href="#">COURSE NAME</a></li>
        </ul>
    </div>
    <div class="friends-search">
    	<div class="top" id="classroom_search_list"></div>
        <div class="input"><input type="text" class="serachInput"></div>
    </div>
    <div class="friends-search-btn"><span class="glyphicon glyphicon-search"></span></div>
</div>

 
<div class="evaluate_payPage">
</div>
<!-- teacher_detail_page -->
<%@include file="/common/teacher_detail.jsp"%>
   
<!----reservation_detail_page----->
<%@include file="/common/reservation_detail.jsp"%>

<!----reservation_detail_chat----->
<%@include file="/common/reservation_chat.jsp"%>
  

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="<%=request.getContextPath()%>/common/js/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="<%=request.getContextPath()%>/common/js/bootstrap.min.js"></script>
    <script src="<%=request.getContextPath()%>/common/js/lightbox-2.6.min.js"></script>
    <!-- 日期时间插件 -->
    <script type="text/javascript" src="<%=request.getContextPath()%>/common/js/adddate.js"></script>
    
    <!--轮播图-->
    <script src="<%=request.getContextPath()%>/common/js/jquery.flexslider-min.js"></script>
    <script src="<%=request.getContextPath()%>/common/js/base.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath()%>/common/js/jquery.range.js"></script>



  <script>
  		int = 1;
  		function teacher_list(tea){
  			var user_id = <%=us.getUser_id() %>;
  			var teacher_html = '<li><div class="container"><div class="row">';
			for(var i = 0; i < tea.length; i++){
				teacher_html = teacher_html
				+ '<div class="col-xs-3 teacher_detail"><a href="javascript:;">'
				+ '<p><img src="<%=request.getContextPath()%>/'
				+ tea[i].teacher_avatar + '"></p><div class="footer">'
				+ '<p class="p1"><span>' + tea[i].teacher_name
				+ '</span><span>' + tea[i].teacher_grade
				+ '</span></p><p class="p2">' + tea[i].teacher_deparment + '</p>'
				+ '<input type="hidden" class="teacher_id" value="' + tea[i].teacher_id + '"/>'
				+ '<input type="hidden" class="teacher_goal" value="' + tea[i].teacher_goal + '"/>';
				if(tea[i].teacher_level_type == 1){
					teacher_html = teacher_html + '<div class="lv green">LV' + tea[i].teacher_star + '</div>';
				}
				teacher_html = teacher_html + '</div></a></div>';
				if(i < tea.length-1 && i%8 == 7){
					teacher_html = teacher_html
					+ '</div></div></li><li><div class="container"><div class="row">';
				}
			}
			teacher_html = teacher_html + '</div></div></li>';
			$("#list_lecture").html(teacher_html);
			$("#Bestteacher a").on("click",function(){
				$(document).scrollTop(0);
				$(".teacher_personal_wrap").show(500);	
				$(".filterBg").show();
				$(".filterBg").css({
					"z-index" : "150"
				});
				var teacherP_height=$(".teacher_personal_wrap").height();
				$("body").css({
					"height" : "600px"
				})
			})
			$(".teacher_detail").on("click",function(){
				$(document).scrollTop(0);
				var teacher_id = $(this).find(".teacher_id").val();
				teacher_detail(teacher_id, user_id);
			});
  		}
  		
  		$(window).scroll(function(){
  			if(!$(".teacher_personal_wrap").is(":hidden")){
  				var h=$(".teacher_personal_wrap").height();
  				//var h1=$(window).height();
  				//h2=h-h1;
  				h=h-450;
  				if($(window).scrollTop()>h){
  					$(window).scrollTop(h);
  				}
  			}
  		})
  		
  		/**
		 * 时间对象的格式化
		*/
		function jsonDateFormat(jsonDate) {//json日期格式转换为正常格式
		     try {
		    	 if(jsonDate==0){
		    		 return "未完成";
		    	 }
		         var date = new Date(parseInt(jsonDate.replace("/Date(", "").replace(")/", ""), 10));
		         var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
		         var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
		         var hours = date.getHours();
		         if(hours<10){
		        	 hours='0' + hours;
		         }
		         var minutes = date.getMinutes();
		         if(minutes<10){
		        	 minutes="0" + minutes;
		         }
		         var seconds = date.getSeconds();
		         var milliseconds = date.getMilliseconds();

		         return date.getFullYear() + "-" + month + "-" + day + " " + hours + ":" + minutes;//+ ":" + seconds + '0' + ":" + milliseconds + '0'
		     } catch (ex) {
		         return "";
		     }
		 }
  		
  		function room_chat_list(reservation_id){
  			
			if(($(".coursename_cont2").is(":hidden")&&$(".coursename_cont10").is(":hidden"))||$(".coursename").css("right")!="0px"){
				int = window.clearInterval(int);
				return false;
			}
			
  			//room_chat_list
			$.ajax({
				type:"get",
				url:"<%=request.getContextPath()%>/app/classroom/chat_list.htm",
				data:{
					"reservation_id":reservation_id
				},
				async:false,
				success:function(data){
					rm = data.data.roomchat;
					room_chat_list_html = "";
					for(var i = 0; i < rm.length; i++){
						room_chat_list_html = room_chat_list_html
						+ '<li>'
						+ '<img src="<%=request.getContextPath()%>/'
						+ rm[i].room_chat_user_avatar + '" class="photo"> '
						+ rm[i].room_chat_user_name + ': ' + rm[i].room_chat_content
						+ '<input type="hidden" id="room_chat_user_name" value="' + rm[i].room_chat_user_name + '"/>'
						+ '<span class="say room_chat_reply"><img src="<%=request.getContextPath()%>/common/images/say.png" width="26" height="19"></span>'
						+ '</li>';
					}
					$("#room_chat_list").html(room_chat_list_html);
					$(".room_chat_reply").on("click",function(){
						$("#room_chat_content").val("@" + $(this).prev().val() + ":");
					})
				}
			});
  		}
  		function teacher_all(limit, offset, school){
  			$.ajax({
				type:"get",
				url:"<%=request.getContextPath()%>/app/teacher/loading.htm",
				data:{
					"limit":-1,
					"offset":-1,
					"school":school
				},
				async:false,
				success:function(data){
					var tea = data.data.teacher;
					teacher_list(tea);
				}
			});
  		}
  		function reservation_list(user_id, school)
  		{
  			$.ajax({
				type:"get",
				url:"<%=request.getContextPath()%>/app/reservation/all.htm",
				data:{
					"id":user_id,
					"school":school
				},
				async:false,
				success:function(data){
					var re = data.data.reservation;
					var reservation_html="";
					for(var i = 0; i < re.length; i++){
						/*if(re[i].user_reservation_status == -1 && re[i].reservation_status != 0)
							continue;*/
						var pay_status = "";
						if(re[i].user_reservation_status < 2){
							pay_status = "Not Paid";
						}
						else{
							pay_status = "Already Paid";
						}
						var ispublic = "";
						if(re[i].reservation_ispublic == 0){
							ispublic = "Public";
						}
						else{
							ispublic = "Private";
						}
						var reservation_time=re[i].reservation_time.time;
						reservation_time=jsonDateFormat(String(reservation_time));
						reservation_html = reservation_html
						+ '<div class="col-xs-3"><div class="cont"><p>COURSE : '
						+ re[i].reservation_course + '</p><p>TIME : '
						+ reservation_time + '</p><p>ADDRESS : '
						+ re[i].reservation_address + '</p><p>STATUS : '
						+ pay_status + '</p><p>TYPE : '
						+ ispublic + '</p>'
						+ '<input type="hidden" id="reservation_id" value="' + re[i].reservation_id + '"/>'
						+ '</div><div class="footer">NUMBER:'
						+ re[i].reservation_number + '</div></div>';
					}
					$("#reservation").html(reservation_html);
					$(".Reservation .col-xs-3").on("click",function(){
						$(document).scrollTop(0);
						if(true || !$(this).hasClass("on")){
							reservation_id = $(this).find("#reservation_id").val();
							int = window.clearInterval(int);
							int=window.setInterval(_foo1(reservation_id),8000);
							reservation_detail(user_id, reservation_id);
						}
				
					});
					
				}
			});
  		}
  		
  		function classroom_detail(classroom_id, user_id){
  			//chat
  			int = window.clearInterval(int);
			int=window.setInterval(_foo(classroom_id),8000);
			
			//detail
			$.ajax({
				type:"get",
				url:"<%=request.getContextPath()%>/app/classroom/detail.htm",
				data:{
					"classroom_id":classroom_id,
					"user_id":user_id
				},
				async:false,
				success:function(data){
					var cd = data.data.classroom_detail;
					var time = cd.classroom_detail_time.time;
					time = jsonDateFormat(String(time));
					time += ":0";
					$("#classroom_detail_course_name").html(cd.classroom_detail_course);
					$("#classroom_detail_reservation_number").val(cd.classroom_detail_reservation_number);
					$("#classroom_detail_school").val(cd.classroom_detail_school);
					$("#classroom_detail_lecture").val(cd.classroom_detail_lecture);
					$("#classroom_detail_max_size").val(cd.classroom_detail_max_size);
					$("#classroom_detail_adress").val(cd.classroom_detail_address);
					$("#classroom_detail_time").val(time);
					$("#classroom_detail_period").val(cd.classroom_detail_period);
					$("#classroom_detail_goal").val(cd.classroom_detail_goal);
					$("#classroom_detail_wage").val(cd.classroom_detail_wage);
					$("#classroom_detail_bonus").val(cd.classroom_detail_bonus);
					
					if(cd.user_reservation_status == 0){
						if($("#classroom_detail_exit_status").hasClass("classroom_detail_exit1") == true){
							$("#classroom_detail_exit_status").removeClass("classroom_detail_exit1");
						}
						if($("#classroom_detail_exit_status").hasClass("classroom_detail_exit") == false){
							$("#classroom_detail_exit_status").addClass("classroom_detail_exit");
						}
					}
					else{
						if($("#classroom_detail_exit_status").hasClass("classroom_detail_exit") == true){
							$("#classroom_detail_exit_status").removeClass("classroom_detail_exit");
						}
						if($("#classroom_detail_exit_status").hasClass("classroom_detail_exit1") == false){
							$("#classroom_detail_exit_status").addClass("classroom_detail_exit1");
						}
					}
					$(".classroom_detail_exit").on("click",function(){
						$(".classroom_detail_dropOut").show();
						$(".filterBg").css({"z-index" : "149"});
					})
					
					$("#classroom_detail_school").attr("readOnly","readonly");
					$("#classroom_detail_lecture").attr("readOnly","readonly");
					$("#classroom_detail_max_size").attr("readOnly","readonly");
					$("#classroom_detail_adress").attr("readOnly","readonly");
					$("#classroom_detail_time").removeAttr("onclick");
					$("#classroom_detail_period").attr("readOnly","readonly");
					$("#classroom_detail_goal").attr("readOnly","readonly");
					$("#classroom_detail_wage").attr("readOnly","readonly");
					$("#classroom_detail_bonus").attr("readOnly","readonly");
					if(cd.classroom_detail_create_id != user_id){
						$.ajax({
							type:"get",
							url:"<%=request.getContextPath()%>/app/user/reservationdetail.htm",
							data:{
								"user_id":user_id,
								"reservation_id":classroom_id,
								"limit":-1,
								"offset":-1
							},
							async:false,
							success:function(data){
								if(data.data.user_reservation_status == 1){
									$(".coursename-list .confirm a").replaceWith('<c style="margin-left:50px;color:#dddddd" class="classroom_detail_wait">Waiting others to confirm!</c>');
								}
								else{
									$(".coursename-list .confirm c").replaceWith('<a href="#" id="classroom_detail_confirm">confirm</a>');
								}
							}
						});
						$(".classroom_detail_edit").hide();
						
					}
					else{
						$(".coursename-list .confirm c").replaceWith('<a href="#">confirm</a>');
						$(".classroom_detail_edit").show();
						$(".classroom_detail_edit").unbind("click").on("click",function(){
							$("#classroom_detail_school").attr("readOnly","readonly");
							$("#classroom_detail_lecture").attr("readOnly","readonly");
							$("#classroom_detail_max_size").attr("readOnly","readonly");
							$("#classroom_detail_adress").attr("readOnly","readonly");
							$("#classroom_detail_time").removeAttr("onclick");
							$("#classroom_detail_period").attr("readOnly","readonly");
							$("#classroom_detail_goal").attr("readOnly","readonly");
							$("#classroom_detail_wage").attr("readOnly","readonly");
							$("#classroom_detail_bonus").attr("readOnly","readonly");
							if($(this).prev().attr("id") == "classroom_detail_time") $("#classroom_detail_time").attr("onclick", "SelectDate(this,'yyyy-MM-dd hh:mm:ss')");
							else $(this).prev().removeAttr("readOnly");
						})
					}
					var ispublic = "";
					if(cd.classroom_detail_public == 0) ispublic = "Public";
					else ispublic = "Private";
					$("#classroom_detail_ispublic").html(ispublic);
					$("#classroom_detail_confirm").on("click", function(){
						if(cd.classroom_detail_create_id != user_id){
							if($(this).children().hasClass("classroom_detail_wait") == true){
								return ;
							}
							$.ajax({
								type:"post",
								url:"<%=request.getContextPath()%>/app/reservation/agree.htm",
								data:{
									"user_id":user_id,
									"reservation_id":classroom_id
								},
								async:false,
								success:function(data){
									alert(data.data.result);
									$(".coursename-list .confirm a").replaceWith('<c style="margin-left:50px;color:#333" class="classroom_detail_wait">Waiting others to confirm!</c>');
								}
							});
						}
						else{
							var school = $("#classroom_detail_school").val();
							var lecture = $("#classroom_detail_lecture").val();
							var max_size = $("#classroom_detail_max_size").val();
							var address = $("#classroom_detail_adress").val();
							var time = $("#classroom_detail_time").val();
							var period = $("#classroom_detail_period").val();
							var goal = $("#classroom_detail_goal").val();
							var wage = $("#classroom_detail_wage").val();
							var bonus = $("#classroom_detail_bonus").val();
							if(course==""){
								alert("Course can not be none!");
								return ;
							}
							if(goal==""){
								alert("goal can not be none!");
								return ;
							}
							if(max_size==""){
								alert("max_size can not be none!");
								return ;
							}
							if(address==""){
								alert("address can not be none!");
								return ;
							}
							if(max_size!="" && isNaN(max_size)){
								alert("max_size must be all digits!");
								return ;
							}
							if(period!="" && isNaN(period)){
								alert("period must be all digits!");
								return ;
							}
							if(goal!="" && isNaN(goal)){
								alert("goal must be all digits!");
								return ;
							}
							if(wage!="" && isNaN(wage)){
								alert("wage must be all digits!");
								return ;
							}
							if(bonus!="" && isNaN(bonus)){
								alert("bonus must be all digits!");
								return ;
							}
							$.ajax({
								type:"get",
								url:"<%=request.getContextPath()%>/app/reservation/update.htm",
								data:{
									"reservation_id":classroom_id,
									"school":school,
									"lecture":lecture,
									"max_size":max_size,
									"address":address,
									"time":time,
									"period":period,
									"goal":goal,
									"wage":wage,
									"bonus":bonus,
								},
								async:false,
								success:function(data){
									console.log(data)
									if(data.code!=0)
									{
										alert(data.message);
									}
									else
									{
										alert("Success for update!");
									}
								}
							})
						}
						/* reservation_detail(user_id, classroom_id);
						$(".coursename").animate({
							"right" :  "-300px"
						});
						$(".coursename-list .bot").animate({"right" : "-300px"}); */
					});
					$("#room_chat_send").unbind("click").on("click", function(){
						if($("#room_chat_content").val()==""){
							return;
						}
						addClassroommessageRemind(classroom_id, user_id);
						var content = $("#room_chat_content").val();
						var to_user_name = "";
						if(content.split(":")[0] != content) to_user_name = content.split(":")[0].split("@")[1]
						$.ajax({
							type:"post",
							url:"<%=request.getContextPath()%>/app/classroom/chat_send.htm",
							data:{
								"reservation_id":classroom_id,
								"user_id":user_id,
								"content":content,
								"to_user_name":to_user_name
							},
							async:false,
							success:function(data){
								room_chat_list(classroom_id);
								$("#room_chat_content").val("");
							}
						});
					});
					$("#classroom_detail_drop_out").unbind("click").on("click",function(){
						$.ajax({
							type:"post",
							url:"<%=request.getContextPath()%>/app/reservation/drop_out.htm",
							data:{
								"user_id":user_id,
								"reservation_id":classroom_id,
							},
							async:false,
							success:function(data){
							}
						});
						$(".classroom_detail_dropOut").hide();
						$(".filterBg").css({"z-index" : "50"});
					})
					
					//member
					$.ajax({
						type:"get",
						url:"<%=request.getContextPath()%>/app/classroom/member.htm",
						data:{
						    "id":classroom_id,
						    "limit":-1,
						    "offset":-1
						},
						async:false,
						success:function(data){
						    var m = data.data.member;
						    //teacher
						    var classroom_member_teacher_html = "";
						    for(var i = 0; i < m.length; i++){
						    	if(m[i].member_type == 1){
							    	classroom_member_teacher_html = classroom_member_teacher_html
							    	+ '<li><span class="photo"><img src="<%=request.getContextPath()%>/' + m[i].member_avatar_url + '"></span>'
							    	+ '<div class="text">'
							    	+ '<p class="name">' + m[i].member_name + '</p>'
							    	+ '<p class="number">' + m[i].member_telephone + '</p>'
							    	+ '</div>'
							    	+ '<div class="payment-number"><span>PAYMENT:' + m[i].member_wage
							    	+ '￡</span>RERIOD:' + m[i].member_period + '</div>'
							    	+ '<input type="hidden" id="classroom_teacher_id" value="' + m[i].member_user_id + '"/>';
							    	if(user_id == cd.classroom_detail_create_id){
							    		classroom_member_teacher_html = classroom_member_teacher_html
							    		+ '<a href="javascript:;" class="agree classroom_teacher_agree">Agree</a>';
							    	}
							    	classroom_member_teacher_html = classroom_member_teacher_html
							    	+ '</li>';
							    }
						    }
						    $("#classroom_member_teacher").html(classroom_member_teacher_html);
						    
						    //student
						    var classroom_member_student_html = "";
						    for(var i = 0; i < m.length; i++){
						    	if(m[i].member_type == 0){
							    	classroom_member_student_html = classroom_member_student_html
							    	+ '<li><span class="photo"><img src="<%=request.getContextPath()%>/' + m[i].member_avatar_url + '"></span>'
							    	+ '<div class="text">'
							    	+ '<p class="name">' + m[i].member_name + '</p>'
							    	+ '<p class="number">' + m[i].member_telephone + '</p>'
							    	+ '<input type="hidden" id="classroom_student_id" value="' + m[i].member_user_id + '"/>'
							    	+ '</div>'
							    	+ '</li>'
							    }
						    }
						    $("#classroom_member_student").html(classroom_member_student_html);
						    
						    $("#classroom_member_student .photo").unbind("click").on("click",function(){
						    	var student_id = $(this).next().find("input").val();
						    	friend_detail(student_id);
						    })
						    
						    $("#classroom_member_teacher .photo").unbind("click").on("click",function(){
						        $(document).scrollTop(0);
						    	var teacher_id = $(this).parent().find("input").val();
						    	teacher_detail(teacher_id, user_id);
						    })
						    
						    $(".classroom_teacher_agree").unbind("click").on("click",function(){
						    	var teacher_id = $(this).prev().val();
						    	$.ajax({
									type:"get",
									url:"<%=request.getContextPath()%>/app/classroom/agreeteacher.htm",
									data:{
									    "classroom_id":classroom_id,
									    "user_id":teacher_id
									},
									async:false,
									success:function(data){
										if(data.data.result == 0) alert("Already Teacher!");
										else{
											alert("Success!");
											classroom_detail(classroom_id, user_id);
										}
									}
								})
						    })
						    
						    $(".classroom-user-search .serachInput").change(function(){
								var friend_name = $(this).val();
								$.ajax({
									type:"get",
									url:"<%=request.getContextPath()%>/app/friend/searchuser.htm",
									data:{
										"name":friend_name,
										"limit":-1,
										"offset":-1,
									},
									async:false,
									success:function(data){
										if(data.code != 0){
											return ;
										}
										u = data.data.user;
										classroom_user_search_list_html = "";
										classroom_user_search_list_html = classroom_user_search_list_html
										+ '<div><span class="photo"><img width="18" height="18" src="<%=request.getContextPath()%>/'
										+ u[0].friend_avatar_url + '"></span>'
										+ u[0].friend_name
										+ '<span class="add"><c class="classroom_user_add">Add</c></span>'
										+ '<input type="hidden" id="seach_classroom_user_id" value="' + u[0].friend_id + '"/>'
										+'</div>';
										$("#classroom_user_search_list").html(classroom_user_search_list_html);
										$(".classroom-user-search .top").show();
										$(".classroom_user_add").on("click", function(){
											var user_search_id = $(this).parent().next().val();
											$.ajax({
												type:"get",
												url:"<%=request.getContextPath()%>/app/user/info.htm",
												data:{
													"id":user_search_id,
													"reservation_limit":-1,
													"reservation_offset":-1,
													"assessment_limit":-1,
													"assessment_offset":-1
												},
												async:false,
												success:function(data){
													var search_user = data.data.user;
													var content = "index.htm?type=1&user_id="+user_search_id+"&reservation_id="+classroom_id+"&user_type="+search_user.user_type+"&user_name="+search_user.user_name;
													$.ajax({
														type:"get",
														url:"<%=request.getContextPath()%>/app/reservation/sendInvite.htm",
														data:{
															"user_id":user_search_id,
															"content":content
														},
														async:false,
														success:function(data){
															alert("Invite successful!");
														}
													})
												}
											});
										});
									}
								});
							});
						}
					})

				}
			});
			
			$(".classroom").animate({
				"right" : "-300px",
				"top" : "100%"
			});
			$(".coursename").animate({
				"right" :  "0"
			});
			$(".coursename-list .bot").animate({"right" : "0"});
  		}
  		
  		function _foo(id)
		{
			return function(){room_chat_list(id);};
		}
		
		function friend_list(user_id){
			//friend
			$.ajax({
				type:"get",
				url:"<%=request.getContextPath()%>/app/friend/loading.htm",
				data:{
					"id":user_id,
					"limit":-1,
					"offset":-1,
				},
				async:false,
				success:function(data){
					console.log(data);
					var f = data.data.friend;
					friend_list_html = "";
					for(var i = 0; i < f.length; i++){
						friend_list_html = friend_list_html
						+ '<li>'
						+ '<span class="photo"><img src="<%=request.getContextPath()%>/'
						+ f[i].friend_avatar_url + '"></span>'
						+ '<div class="text">'
						+ '<p class="p1">' + f[i].friend_name + '</p>'
						+ '<p class="p2"><span class="green invite"><c class="friend_invite">Invite</c></span><span class="green remove"><c class="friend_remove">Remove</c></span></p>'
						+ '<input type="hidden" id="friend_id" value="' + f[i].friend_id + '"/>'
						+ '</div></li>';
					}
					$("#friend_list").html(friend_list_html);
					if(data.data.friend.length==0){
						
						var list=$(
							'<div class="friend_none" style="line-height:100px;text-align:center;color:#fff;font-size:18px;">' + 'none' + '<div>'
						)
						$(".friends .friend_none").remove();
						list.appendTo($(".friends"));
					}
					else{
						$(".friends .friend_none").remove();
					}
					$("#friend_list .photo").on("click",function(){
						var friend_id = $(this).next().find("#friend_id").val();
						friend_detail(friend_id);
					});
					$(".friends .serachInput").change(function(){
						var friend_name = $(this).val();
						var top = $(this).parents(".input").prev(".top");
						$.ajax({
							type:"get",
							url:"<%=request.getContextPath()%>/app/friend/searchuser.htm",
							data:{
								"name":friend_name,
								"limit":-1,
								"offset":-1,
							},
							async:false,
							success:function(data){
								if(data.code != 0){
									return ;
								}
								u = data.data.user;
								friend_search_list_html = "";
								if(u.length > 0){
									friend_search_list_html = friend_search_list_html
									+ '<li><span class="photo"><img src="<%=request.getContextPath()%>/'
									+ u[0].friend_avatar_url + '"></span>'
									+ u[0].friend_name
									+ '<span class="add"><c class="friend_add">Add</c></span>'
									+ '<input type="hidden" id="seach_friend_id" value="' + u[0].friend_id + '"/>'
									+'</li>';
								}
								$("#friend_search_list").html(friend_search_list_html);
								$(".friends .top").show();
								$(".friend_add").unbind("click").on("click", function(){
									$.ajax({
										type:"post",
										url:"<%=request.getContextPath()%>/app/friend/add.htm",
										data:{
											"head_id":user_id,
											"dependent_id":$("#seach_friend_id").val()
										},
										async:false,
										success:function(data){
											alert(data.data.result);
											$(".friends .top").hide();
										}
									});
									friend_list(user_id);
								});
							}
						});
					});
					$(".friend_remove").unbind("click").on("click", function(){
						var dependent_id = $(this).parents(".p2").next().val();
						$.ajax({
							type:"get",
							url:"<%=request.getContextPath()%>/app/friend/delete.htm",
							data:{
								"head_id":user_id,
								"dependent_id":dependent_id
							},
							async:false,
							success:function(data){
								alert(data.data.result);
							}
						});
						friend_list(user_id);
					});
					
					$(".friend_invite").unbind("click").on("click", function(){
						var dependent_id = $(this).parents(".p2").next().val();
						$.ajax({
							type:"get",
							url:"<%=request.getContextPath()%>/app/user/reservation.htm",
							data:{
								"id":user_id,
							},
							async:false,
							success:function(data){
								var re = data.data.reservation;
								var friend_choose_classroom_html = "";
								for(var i = 0; i < re.length; i++){
									if(re[i].reservation_status > 1){
										continue;
									}
									friend_choose_classroom_html = friend_choose_classroom_html
									+ '<li>'
									+ '<span class="glyphicon glyphicon-user"></span><span class="glyphicon glyphicon-user"></span>'
									+ '<a href="#" class="classroom_join">' + re[i].reservation_course + '</a>'
									+ '<input type="hidden" id="classroom_id" value="' + re[i].reservation_id + '"/>'
									+ '</li>';
								}
								$("#friend_choose_classroom").html(friend_choose_classroom_html);
								$(".chooseClassRoom .serachInput").change(function(){
									classroom_search_list_html = "";
									for(var i = 0; i < re.length; i++){
										if(re[i].reservation_number == $(this).val()){
											classroom_search_list_html = classroom_search_list_html
											+ '<li><span class="photo"><img src="<%=request.getContextPath()%>/common/images/photo.png"></span>'
											+ re[i].reservation_course
											+ '<span class="add"><c class="classroom_add">Add</c></span>'
											+ '<input type="hidden" id="classroom_id" value="' + re[i].reservation_id + '"/>'
											+'</li>';
										}
									}
									$(".chooseClassRoom .top").html(classroom_search_list_html);
									$(this).parents(".input").prev(".top").show();
									$(".classroom_add").on("click", function(){
										var classroom_id = $(this).parent().next().val();
										reservation_join(dependent_id, classroom_id);
										$(".chooseClassRoom .top").hide();
									});
								});
								$(".classroom_join").on("click", function(){
									var classroom_id = $(this).next().val();
									reservation_join(dependent_id, classroom_id);
									$(".chooseClassRoom .top").hide();
									$(".friends").animate({
										"right" : "0",
										"top" : "0"
									});
									
									$(".chooseClassRoom").animate({
										"right" : "-300px"
									});
								});
							}
						});
						$(".friends").animate({
							"right" : "-300px"
						});
						$(".chooseClassRoom").animate({
							"right" : "0"
						});
					});
				}
			});
			$(".filterBg").show();
			$(".friends").animate({
				"right" : "0px"	
			});
		}
		
		function _foo2(user_id)
		{
			return function(){detectRemind(user_id);};
		}
		
		function detectRemind(user_id){
			//detect new classroom message
	 		$.ajax({
				type:"get",
				url:"<%=request.getContextPath()%>/app/remind/hasNewRemind.htm",
				data:{
					"user_id":user_id,
					"type":0
				},
				async:false,
				success:function(data){
					if(data.data.result == 1){
						$("#classroom_new_remind").html('<c class="addNewRemind">●</c>');
					}
				}
			})
		}
		
		function cancelRemind(user_id, type){
	 		$.ajax({
				type:"get",
				url:"<%=request.getContextPath()%>/app/remind/cancelRemind.htm",
				data:{
					"user_id":user_id,
					"type":type
				},
				async:false,
				success:function(data){
				}
			})
	 	}
	 	
	 	function addClassroommessageRemind(classroom_id, user_id){
			$.ajax({
				type:"get",
				url:"<%=request.getContextPath()%>/app/remind/addNewRemind.htm",
				data:{
					"data_id":classroom_id,
					"user_id":user_id,
					"type":0
				},
				async:false,
				success:function(data){
				}
			})
	 	}
	 	
	 	function addPersonalmessageRemind(user_id){
			$.ajax({
				type:"get",
				url:"<%=request.getContextPath()%>/app/remind/addNewRemind.htm",
				data:{
					"data_id":user_id,
					"type":2
				},
				async:false,
				success:function(data){
				}
			})
	 	}
		
		$(document).ready(function(){
			var user_id = <%=us.getUser_id() %>;
			var user_type = <%=us.getUser_type() %>;
			var user_name = '<%=us.getUser_name() %>';
			var user_school = '<%=us.getUser_school() %>'; 
			user_school_confirm = "<%=us.getUser_school()%>";
			
			int_detectRemind=window.setInterval(_foo2(user_id),8000);
			
			if(<%=request.getAttribute("type")%> == 1){
				reservation_detail(<%=request.getAttribute("user_id")%>, <%=request.getAttribute("reservation_id")%>,<%=request.getAttribute("user_type")%>, '<%=request.getAttribute("user_name")%>');
			}
			
			$(".sliderLink .new").on("click",function(){
				if(user_type == 0){
				    lecture_html = '<li title="lecture"><span class="dis">Lecturer:</span><input type="text" class="input new_reservation_lecture" name="lecture" onblur="new_lecture_search(this)"></li>';
				}
				else{
					lecture_html = '<li class="text" title="lecture"><span class="text">Lecturer:'
					+ user_name + '</span></li>';
				}
				$(".apply_lecture").html(lecture_html);
				$(".reservation_window").show();
				$(".reservation_window").css({"z-index" : "180"})
				$(".filterBg").show();
				$(".filterBg").css({"z-index" : "150"});
			})
			
			
			$.ajax({
				type:"get",
				url:"<%=request.getContextPath()%>/app/user/school.htm",
				data:{
				},
				async:false,
				success:function(data){
					s = data.data.school;
					school_list_html = "";
					for(var i = 0; i < s.length; i++){
						school_list_html = school_list_html
						+ '<p><a href="#" class="school_confirm">' + s[i].school_name
						+ '</a></p>';
					}
					$("#school_list").html(school_list_html);
					
					$(".school_confirm").unbind("click").on("click", function(){
						$("#user_school").html($(this).html());
						user_school_confirm = $(this).html();
						teacher_all(-1, -1, $(this).html());
						reservation_list(user_id, $(this).html());
					})
				}
			});
			
			$.ajax({
				type:"get",
				url:"user/interest.htm",
				data:{
					"limit":-1,
					"offset":-1
				},
				async:false,
				success:function(data){
					var interest = data.data.interest;
					var course_list_html = "<option></option>";
					for(var i = 0; i < interest.length; i++){
						course_list_html = course_list_html
						+ '<option>' + interest[i].interest_name + '</option>';
					}
					$("#course").html(course_list_html);
				}
			});
			
			teacher_all(-1, -1, user_school);
			reservation_list(user_id, user_school_confirm);
			$(".friendsBtn").on("click",function(){
				friend_list(user_id);
			});
			
			//classroom
			$(".f-Classroom").on("click",function(){
				cancelRemind(user_id, 0);
				$("#classroom_new_remind").html('');
				$.ajax({
					type:"get",
					url:"<%=request.getContextPath()%>/app/classroom/loading.htm",
					data:{
						"id":user_id,
						"limit":-1,
						"offset":-1,
					},
					async:false,
					success:function(data){
						//console.log(data);
						
						var c = data.data.classroom;
						if(data.data.classroom.length==0){
							$("#classroom_list li").remove();
							var list=$(
								'<div style="line-height:100px;text-align:center;color:#fff;font-size:18px;">' + 'none' + '</div>'
							)
							$(".classroom div").remove();
							list.appendTo($(".classroom"));
						}
						else{
							$(".classroom div").remove();
							var classroom_list_html = "";
							for(var i = 0; i < c.length; i++){
								classroom_list_html += '<li class="classroom_button">'
								+ '<p>' + c[i].classroom_course + '</p>'
								+ '<p>TEACHER: ' + c[i].classroom_teacher_name + '</p>'
								+ '<a href="javascript:;" class="glyphicon glyphicon-menu-right"></a>'
								+ '<input type="hidden" id="classroom_id" value="' + c[i].classroom_id + '"/>'
								+ '<input type="hidden" id="classroom_status" value="' + c[i].classroom_status + '"/>'
								+ '</li>';
							}
							$("#classroom_list").html(classroom_list_html);
						}
						$(".classroom_button").on("click",function(){
							classroom_id = $(this).find("#classroom_id").val();
							if($(this).find("#classroom_status").val() > 0){
								window.location.href="index.htm?type=1&user_id="+user_id+"&reservation_id="+classroom_id+"&user_type="+user_type+"&user_name="+user_name;
							}
							else{
								classroom_detail(classroom_id, user_id);
							}
						});
					}
				});
				$(".classroom").animate({
					"right" : "0px",
					"top" : "0"
				});
				
				$(".filterBg").show();
				$(".filterBg").css({"z-index" : "50"});
				
			});
		});
		$("#search_lecture").on("click",function(){
			$.ajax({
				type:"get",
				url:"<%=request.getContextPath()%>/app/teacher/search.htm",
				data:{
					"school":user_school_confirm,
					"lecture":$("#lecture").val(),
					"course":$('#course option:selected').text(),
					"limit":-1,
					"offset":-1
				},
				async:false,
				success:function(data){
					var tea = data.data.teacher;
					teacher_list(tea);
				}
			});
			var user_id = <%=us.getUser_id() %>;
			$.ajax({
				type:"get",
				url:"<%=request.getContextPath()%>/app/reservation/search.htm",
				data:{
					"school":user_school_confirm,
					"lecture":$("#lecture").val(),
					"course":$('#course option:selected').text(),
					"id":user_id,
					"limit":-1,
					"offset":-1
				},
				async:false,
				success:function(data){
					var re = data.data.reservation;
					var reservation_html="";
					for(var i = 0; i < re.length; i++){
						/*if(re[i].user_reservation_status == -1 && re[i].reservation_status != 0)
							continue;*/
						var pay_status = "";
						if(re[i].user_reservation_status < 2){
							pay_status = "Not Paid";
						}
						else{
							pay_status = "Already Paid";
						}
						var ispublic = "";
						if(re[i].reservation_ispublic == 0){
							ispublic = "Public";
						}
						else{
							ispublic = "Private";
						}
						var reservation_time=re[i].reservation_time.time;
						reservation_time=jsonDateFormat(String(reservation_time));
						reservation_html = reservation_html
						+ '<div class="col-xs-3"><div class="cont"><p>COURSE : '
						+ re[i].reservation_course + '</p><p>TIME : '
						+ reservation_time + '</p><p>ADDRESS : '
						+ re[i].reservation_address + '</p><p>STATUS : '
						+ pay_status + '</p><p>TYPE : '
						+ ispublic + '</p>'
						+ '<input type="hidden" id="reservation_id" value="' + re[i].reservation_id + '"/>'
						+ '</div><div class="footer">NUMBER:'
						+ re[i].reservation_number + '</div></div>';
					}
					$("#reservation").html(reservation_html);
					//alert(reservation_html);
					$(".Reservation .col-xs-3").on("click",function(){
						if(true || !$(this).hasClass("on")){
							//alert($(this).find("#reservation_id").val());
							var reservation_id = $(this).find("#reservation_id").val();
							int = window.clearInterval(int);
							int=window.setInterval(_foo1(reservation_id),8000);
							reservation_detail(user_id, reservation_id);
						}
					});
				}
			});
		});
		
		$(function(){
			$('.single-slider').jRange({
				from: 0,
				to: 100,
				step: 1,
				scale: [0,25,50,75,100],
				format: '%s',
				width: 300,
				showLabels: true,
				showScale: true
			});
			$('.range-slider').jRange({
				from: 0,
				to: 100,
				step: 1,
				scale: [0,25,50,75,100],
				format: '%s',
				width: 300,
				showLabels: true,
				isRange : true
			});
         
		
		//选择搜索
		/*$("#select_clauses input").on("click",function(){
			$(this).toggleClass("on");
			var selectArr=[];
			var type='';
			if($(this).hasClass("on")){
				type=1;
				var onInput=$(this).parent().text();
				var onTinput=$(this).parents(".col-xs-10").prev().text();
				selectArr.push(type);
				selectArr.push(onTinput);
				selectArr.push(onInput);
			}else{
				type=0;
				var onInput=$(this).parent().text();
				var onTinput=$(this).parents(".col-xs-10").prev().text();
				selectArr.push(type);
				selectArr.push(onTinput);
				selectArr.push(onInput);
			}
			alert(selectArr)
			
		})*/
		$("#select_clauses input").on("click",function(){
			$(this).toggleClass("on");
			var select_str = "";
			select_str = select_str
			+ $("#lecture").val() + ',' + $('#course option:selected').text() + ',';
			var tmp_str = "";
			var index = 0;
			$(".department_list").each(function(i, item){
				if($(this).hasClass("on")){
					if(index > 0) tmp_str += '#';
					tmp_str += $(this).parent().text();
					index++;
				}
			})
			select_str += tmp_str + ',';
			tmp_str = "";
			index = 0;
			$(".grade_list").each(function(i, item){
				if($(this).hasClass("on")){
					if(index > 0) tmp_str += '#';
					tmp_str += $(this).parent().text();
					index++;
				}
			})
			select_str += tmp_str + ',';
			tmp_str = "";
			index = 0;
			$(".goal_list").each(function(i, item){
				if($(this).hasClass("on")){
					if(index > 0) tmp_str += '#';
					tmp_str += $(this).attr("value");
					index++;
				}
			})
			select_str += tmp_str;
			$.ajax({
				type:"get",
				url:"<%=request.getContextPath()%>/app/teacher/search2.htm",
				data:{
					"school":user_school_confirm,
					"select_str":select_str,
				},
				async:false,
				success:function(data){
					var tea = data.data.teacher;
					teacher_list(tea);
				}
			});
			
			var user_id = <%=us.getUser_id() %>;
			$.ajax({
				type:"get",
				url:"<%=request.getContextPath()%>/app/reservation/search2.htm",
				data:{
					"school":user_school_confirm,
					"id":user_id,
					"select_str":select_str
				},
				async:false,
				success:function(data){
					var re = data.data.reservation;
					var reservation_html="";
					for(var i = 0; i < re.length; i++){
						/*if(re[i].user_reservation_status == -1 && re[i].reservation_status != 0)
							continue;*/
						var pay_status = "";
						if(re[i].user_reservation_status < 2){
							pay_status = "Not Paid";
						}
						else{
							pay_status = "Already Paid";
						}
						var ispublic = "";
						if(re[i].reservation_ispublic == 0){
							ispublic = "Public";
						}
						else{
							ispublic = "Private";
						}
						var reservation_time=re[i].reservation_time.time;
						reservation_time=jsonDateFormat(String(reservation_time));
						reservation_html = reservation_html
						+ '<div class="col-xs-3"><div class="cont"><p>COURSE : '
						+ re[i].reservation_course + '</p><p>TIME : '
						+ reservation_time + '</p><p>ADDRESS : '
						+ re[i].reservation_address + '</p><p>STATUS : '
						+ pay_status + '</p><p>TYPE : '
						+ ispublic + '</p>'
						+ '<input type="hidden" id="reservation_id" value="' + re[i].reservation_id + '"/>'
						+ '</div><div class="footer">NUMBER:'
						+ re[i].reservation_number + '</div></div>';
					}
					$("#reservation").html(reservation_html);
					//alert(reservation_html);
					$(".Reservation .col-xs-3").on("click",function(){
						if(true || !$(this).hasClass("on")){
							//alert($(this).find("#reservation_id").val());
							var reservation_id = $(this).find("#reservation_id").val();
							int = window.clearInterval(int);
							int=window.setInterval(_foo1(reservation_id),8000);
							reservation_detail(user_id, reservation_id);
						}
					});
				}
			});
		})
	});
	
	
	</script>
  </body>
</html>